﻿using System;
using System.Linq;
using System.ServiceProcess;

namespace RemoteWorker.Worker
{
    internal static class Program
    {
        private const string RunInConsoleArgumentName = "-console";
        private const string RunInConsoleArgumentShortName = "-c";

        private static void Main(string[] args)
        {
            RemoteWorkerService remoteWorkerService = new RemoteWorkerService();

            if (args != null && args.Any(a => a == RunInConsoleArgumentName || a == RunInConsoleArgumentShortName))
            {
                remoteWorkerService.Start(args);
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
                remoteWorkerService.ConsoleStop();
            }
            else
                ServiceBase.Run(remoteWorkerService);
        }
    }
}